<template>
    <div class="page-box">
        <div class="page-search">
            
            <div>
                <label>员工编号</label>
                <el-input v-model="searchForm.PersonCode" style="width: 160px;" placeholder="请输入工序编码"></el-input>
             </div>

             <div>
                <label>员工姓名</label>
                <el-input v-model="searchForm.Name" style="width: 160px;" placeholder="请输入工序名称"></el-input>
             </div>

             <div>
                 <el-button type="primary" @click="search">查询</el-button>
                 <el-button @click="reset">重置</el-button>
             </div>
        </div>

        <div class="page-section">
  
  
            <!--表单-->
            <el-table :data="tableData"  ref="dataForm"   v-loading="isLoading" row-key="Id" default-expand-all :tree-props="{children: 'children', hasChildren: 'hasChildren'}">
                <el-table-column  type="selection" width="55"></el-table-column>
                <el-table-column  fixed prop="PersonCode" label="员工编号" :show-overflow-tooltip="true"></el-table-column>
                <el-table-column  prop="Name" label="员工姓名" :show-overflow-tooltip="true"></el-table-column>
                 
                <el-table-column   label="操作" :show-overflow-tooltip="true">
                    <template slot-scope="scope">
                        <el-button type="text" @click="Checked(scope.row)">选择</el-button>
                    </template>
                </el-table-column>
            </el-table>
     
  
             
        </div>
  
    </div>
  </template>
<script>        
  
export default{
    mounted(){
        this.dataBind();
    },
    data(){
        return{
  
            //搜索字段
            searchForm:{
                PersonCode:'',
                Name:'',
            },
            tableData:[],
            isLoading:false,
             
  
        }
    },
    methods:{
         
        search(){
             this.dataBind();
        },
        reset(){
            this.searchForm.PersonCode='';
            this.searchForm.Name='';
        },
        Checked(model){
            this.$emit('callback',model);
        },
  
         //获取数据
        dataBind(){
            this.isLoading=true;
            this.$http.get('/api/ProTemporaryWorkHours/GetEmployeesAllAsync',
            {
                params:{
                     PersonCode:this.searchForm.PersonCode,
                     Name:this.searchForm.Name,
                }
            })
            .then(res=>{
                this.tableData=res.Data;
                this.isLoading=false;
            })
        },
     }
}
</script>
  